from flask import request
from flask_classy import FlaskView, route

from ..schema.resp import query_schema , metadata_list_schema
from ..services.metadata import MetadataService


class ProductCategoriesView(FlaskView):
    @route('/')
    def get_list(self):
        type = request.args.get('type')

    @route('<id>/metadata')
    def get_metadata(self, id):
        metadata_list = MetadataService.get_metadata_by_type(id)
        return query_schema.jsonify_with(
            items=metadata_list_schema.dump(metadata_list).data
        )
